//cardtest4 -- smithy
//Getting seg fault ??
#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>

int main(int argc, char const *argv[])
{
	int i, j;
	int player;
	struct gameState state;
	int handPos, checkcount;
	for(i = 0; i < 2000; i++){
		for (j = 0; j < sizeof(struct gameState); j++) {
			((char*)&state)[j] = floor(Random() * 256);
		}
		player = rand() % 5;
		state.handCount[player] = rand() % MAX_HAND;
		checkcount = state.handCount[player];
		for(j = 0; j < state.handCount[player]; j++){
			state.hand[player][j] = rand() % 27;
		}
		handPos = rand() % state.handCount[player];
		state.hand[player][handPos] = 13;
		smithyCard(player, &state, handPos);
		//hand +3 & -1 -> +2
		if(checkcount + 2 == state.handCount[player]){
			printf("Pass\n");
		} else {
			printf("Fail\n");
		}
	}

	return 0;
}